package PangController;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

/**
 * Created by baraaorabi on 5/1/15.
 */
public class PangKeyListener implements KeyListener {

    private final boolean[] keysPressed;

    PangKeyListener(boolean[] keysPressed){
        super();
        this.keysPressed = keysPressed;
    }
    
    @Override
    public void keyTyped(KeyEvent e) {

    }
    
    @Override
    public void keyPressed(KeyEvent e) {

    }

    @Override
    public void keyReleased(KeyEvent e) {
        if(e.getKeyCode() == KeyEvent.VK_A){
            keysPressed[InputManager.LEFT] = true;
        }

        else if(e.getKeyCode() == KeyEvent.VK_D){
            keysPressed[InputManager.RIGHT] = true;
        }

        else if(e.getKeyCode() == KeyEvent.VK_P){
            keysPressed[InputManager.PAUSE] = true;
        }

        else if(e.getKeyCode() == KeyEvent.VK_SPACE){
            keysPressed[InputManager.SHOOT] = true;
        }
    }
}
